




#include"gl_Graphics.h"





/// <summary>
/// 图标结构体初始化。
/// </summary>
/// <param name="ic"></param>
/// <param name="buffer"> 已经定义好的图标图片的数组，长度是w*h</param>
/// <param name="w">图像宽度</param>
/// <param name="h">图像高度</param>
void icon_init(icon* ic, const COLOR_RGB* buffer, int w, int h)
{
	ic->buffer = buffer;
	ic->width = w;
	ic->height = h;
}

/// <summary>
/// 图像结构体初始化。
/// </summary>
/// <param name="im">图像区域</param>
/// <param name="buffer"> 已经分配好的数组，长度是w*h</param>
/// <param name="w">图像宽度</param>
/// <param name="h">图像高度</param>
void image_init(image* im, COLOR_RGB* buffer, int w, int h)
{
	im->buffer = buffer;
	im->width = w;
	im->height = h;
}

/// <summary>
/// 将图标复制到图片。 >> 从ic的left，top位置，截取im.width,im.height的区域复制给im
/// </summary>
/// <param name="ic">图标资源</param>
/// <param name="im">图片</param>
/// <param name="left">复制的图标资源左侧位置</param>
/// <param name="top">复制的图标资源右侧位置</param>
/// <param name="back_color">背景颜色，超出图标范围的区域用背景色填充</param>
void icon_copyto_image(icon ic, image im, int left, int top,COLOR_RGB back_color) 
{
	for (int i = 0; i < im.height; i++) {
		for (int j = 0; j < im.width; j++) {
			if (top + i < ic.height && left + j < ic.width) {
				im.buffer[i * im.width + j] = ic.buffer[(top + i) * ic.width + left + j];
			}
			else
			{
				im.buffer[i * im.width + j] = back_color;
			}
		}
	}

}


/// <summary>
/// 绘制竖直线
/// </summary>
/// <param name="x">竖线的x坐标，是线宽的中点坐标</param>
/// <param name="y0">竖线的y轴起点</param>
/// <param name="y1">竖线的y轴终点</param>
/// <param name="width">线的宽度</param>
/// <param name="color">线条颜色</param>
void draw_line_vertical(int x, int y0, int y1, int width, COLOR_RGB color)
{
	int length;
	int t;    //用于交换坐标时临时保存变量
	if (y0 > y1) {//交换顶点,使得起始点低于终点
		t = y0;
		y0 = y1;
		y1 = t;
	}
	length = y1 - y0;
	if (width > 1) {
		int ls = x - width / 2;
		graphics_fill_area(ls, y0, width, length, color);
	}
	else {
		graphics_fill_area(x, y0, 1, length, color);
	}
}

/// <summary>
/// 绘制水平线
/// </summary>
/// <param name="y">水平线y坐标，是线宽的中点坐标</param>
/// <param name="x0">水平线x轴起点坐标</param>
/// <param name="x1">水平线x轴终点坐标</param>
/// <param name="width">线的宽度</param>
/// <param name="color">线条颜色</param>
void draw_line_horizontal(int y, int x0, int x1, int width, COLOR_RGB color)
{
	int t;    //用于交换坐标时临时保存变量
	int length;
	if (x0 > x1) {//交换顶点,使得起始点低于终点
		t = x0;
		x0 = x1;
		x1 = t;
	}
	length = x1 - x0;
	if (width > 1) {
		int ls = y - width / 2;
		graphics_fill_area(x0, ls, length, width, color);
	}
	else {
		graphics_fill_area(x0, y, length, 1, color);
	}
}


/// 这里的绘制函数要保证运算速度，不做越界判断与处理。


/// <summary>
/// 画线函数。用中点Bresenham算法。
/// </summary>
/// <param name="x0">线的起点x轴坐标</param>
/// <param name="y0">线的起点y轴坐标</param>
/// <param name="x1">线的终点x轴坐标</param>
/// <param name="y1">线的终点y轴坐标</param>
/// <param name="color">线条颜色</param>
void draw_line(int x0, int y0, int x1, int y1, COLOR_RGB color)
{
	if (x0 == x1)//绘制垂线
	{
		//	draw_line_vertical((x0), (y0), (y1), 1, color);
		if (y0 > y1)
			graphics_fill_area(x0, y1, 1, y0 - y1, color);
		else
			graphics_fill_area(x0, y0, 1, y1 - y0, color);

	}
	else if (y0 == y1)//绘制水平线
	{
		//	draw_line_horizontal((y0), (x0), (x1), 1, color);
		if (x0 > x1)
			graphics_fill_area(x1, y0, x0 - x1, 1, color);
		else
			graphics_fill_area(x0, y0, x1 - x0, 1, color);

	}
	else {

		int dx = ABS(x1 - x0), sx = x0 < x1 ? 1 : -1;
		int dy = ABS(y1 - y0), sy = y0 < y1 ? 1 : -1;
		int erro = (dx > dy ? dx : -dy) / 2;
		int e2;
		while (graphics_draw_point(x0, y0, color), x0 != x1 || y0 != y1) {
			e2 = erro;
			if (e2 > -dx) { erro -= dy; x0 += sx; }
			if (e2 < dy) { erro += dx; y0 += sy; }
		}
	}
}


/// <summary>
/// 绘制射线。用中点Bresenham算法。这里的绘制长度固定是len.
/// line_segment：线段
/// ray: 射线
/// </summary>
/// <param name="x0">射线的起点x轴坐标</param>
/// <param name="y0">射线的起点y轴坐标</param>
/// <param name="dx">射线方向x分量</param>
/// <param name="dy">射线方向y分量</param>
/// <param name="len">绘制的射线长度</param>
/// <param name="color">线条颜色</param>
void draw_ray(int x0, int y0, int dx, int dy, int len, COLOR_RGB color)
{
	int x1 = x0 + dx * len;
	int y1 = y0 + dy * len;

	if (x0 == x1)//绘制垂线
	{
		//	draw_line_vertical((x0), (y0), (y1), 1, color);
		if (y0 > y1)
			graphics_fill_area(x0, y1, 1, len, color);
		else
			graphics_fill_area(x0, y0, 1, len, color);

	}
	else if (y0 == y1)//绘制水平线
	{
		if (x0 > x1)
			graphics_fill_area(x1, y0, len, 1, color);
		else
			graphics_fill_area(x0, y0, len, 1, color);

	}
	else {
		int pi = 0;
		int dx = ABS(x1 - x0), sx = x0 < x1 ? 1 : -1;
		int dy = ABS(y1 - y0), sy = y0 < y1 ? 1 : -1;
		int erro = (dx > dy ? dx : -dy) / 2;
		int e2;
		while (graphics_draw_point(x0, y0, color), pi++, x0 != x1 || y0 != y1) {
			e2 = erro;
			if (e2 > -dx) { erro -= dy; x0 += sx; }
			if (e2 < dy) { erro += dx; y0 += sy; }
			if (pi >= len)break;
		}
	}
}

/// <summary>
/// 绘制箭头，箭头方向从0到1。 箭头样式是固定的
/// 箭头夹角90度，箭头尺寸5个像素。
/// </summary>
/// <param name="x0">线的起点x轴坐标</param>
/// <param name="y0">线的起点y轴坐标</param>
/// <param name="x1">线的终点x轴坐标</param>
/// <param name="y1">线的终点y轴坐标</param>
/// <param name="color">线条颜色</param>
void draw_arrow(int x0, int y0, int x1, int y1, COLOR_RGB color)
{
	draw_line(x0, y0, x1, y1, color);
	int x, y;
	int dx = x0 - x1;
	int dy = y0 - y1;
	int dx2 = -dy;
	int dy2 = dx;

	int mx = (dx + dx2);
	int my = (dy + dy2);
	// 箭头夹角90度，箭头尺寸5个像素。
	draw_ray(x1, y1, mx, my, 8, color);
	draw_ray(x1, y1, my, -mx, 8, color);
}


/// <summary>
/// 画实心圆函数
/// </summary>
/// <param name="cx">圆心的x轴坐标</param>
/// <param name="cy">圆心的y轴坐标</param>
/// <param name="R">圆的半径</param>
/// <param name="color">圆的颜色</param>
void draw_solidcircle(int cx, int cy, int R, COLOR_RGB color)	//圆中点Bresenham算法。
{
	int x, y, d2, p2;
	x = 0; y = R;
	d2 = R * R;
	p2 = y * y; // =  x * x + y * y;
	while (x <= y)
	{
		//八分法画圆
		// 绘制横线速度更快
		graphics_fill_area((-y + cx), (x + cy),  (y << 1) + 1,1, color);
		graphics_fill_area((-y + cx), (-x + cy),  (y << 1) + 1,1, color);
		graphics_fill_area((-x + cx), (y + cy),  (x << 1) + 1,1, color);
		graphics_fill_area((-x + cx), (-y + cy),  (x << 1) + 1,1, color);
		//graphics_fill_area((x + cx), (-y + cy), 1, y << 1, color);
		//graphics_fill_area((y + cx), (-x + cy), 1, x << 1, color);
		//graphics_fill_area((-x + cx), (-y + cy), 1, y << 1, color);
		//graphics_fill_area((-y + cx), (-x + cy), 1, x << 1, color);
		p2 += (1 + (x << 1));    //  p2 = x * x + y * y;  (x+1)^2 = x*x +2*x + 1
		x++;
		if (p2 > d2) {  // 超过圆的半径，y减小
			p2 += (1 - (y << 1));
			y--;
		}
	}

}


/// <summary>
/// 画圆函数。 圆形的长宽是 R*2+1，
/// </summary>
/// <param name="cx">圆心的x轴坐标</param>
/// <param name="cy">圆心的y轴坐标</param>
/// <param name="R">圆的半径</param>
/// <param name="color">圆的颜色</param>
void draw_circle(int cx, int cy, int R, COLOR_RGB color)	//
{
	int x = 0, y = R, d_xy0 = 0, d_xy1 = 0, d_xy = 0;

	while (x <= R && y >= 0)
	{
		//四分法画圆
		graphics_draw_point((x + cx), (y + cy), color);     //x,y
		graphics_draw_point((x + cx), (-y + cy), color);    //x,-y
		graphics_draw_point((-x + cx), (-y + cy), color);   //-x,-y
		graphics_draw_point((-x + cx), (y + cy), color);   //-x,y
		
		if (x <= y) {
			// d_y0: (x+1,y) 与R的距离平方。 d_y1: (x+1,y-1) 与R的距离平方。
			d_xy0 = d_xy + (x << 1) + 1;
			d_xy1 = d_xy + 2 - ((y - x) << 1);
			x++;
			if (d_xy0 + d_xy1 > 0) {
				d_xy = d_xy1;
				y--;
			}
			else {
				d_xy = d_xy0;
			}
		}
		else
		{
			// d_y0: (x,y-1) 与R的距离平方。 d_y1: (x+1,y-1) 与R的距离平方。
			d_xy0 = d_xy - (y << 1) + 1;
			d_xy1 = d_xy + 2 - ((y - x) << 1);
			y--;
			if (d_xy0 + d_xy1 < 0) {
				d_xy = d_xy1;
				x++;
			}
			else {
				d_xy = d_xy0;
			}		
		}

	}
}
//

//#define Bresenham_circle_iterator_init(x,y,R) \
//int x = 0, y = R, x##y##p2 = R * R, x##y##d2 = R * R + R; bool is_##x = true;  // int((R+0.5)*(R+0.5)) = R*R+R; 像素半径最外围
//
//#define Bresenham_circle_iterator(x,y) \
//if (x##y##p2 > x##y##d2) { x##y##p2 += (1 - (y << 1)); is_##x = false;	y--; }\
//else { x##y##p2 += (1 + (x << 1));  is_##x = true;	x++; }  // 超过圆的半径最外围，y减小。 p2 = x * x + y * y;  (x+1)^2 = x*x +2*x + 1


/// <summary>
/// 绘制圆环  Bresenham_circle_iterator_init
/// </summary>
/// <param name="cx">圆心中点x坐标</param>
/// <param name="cy">圆心中点y坐标</param>
/// <param name="r1">圆心第一个半径</param>
/// <param name="r2">圆环第二个半径</param>
/// <param name="fill_color">圆环半径之间的填充色</param>
void draw_ring(int cx, int cy, int r1, int r2, COLOR_RGB fill_color) {

	//  r1 是内径，r2是外径
	if (r1 > r2) {  
		int a = r2;
		r2 = r1;
		r1 = a;
	}
	if (r2 <= 0)return;
	if (r1 <= 0)r1 = 0;

	Bresenham_circle_iterator_init(y1, x1, r1);
	Bresenham_circle_iterator_init(y2, x2, r2);
	int len;
	while (y1 <= r1 && x1 >= 0)
	{
		if (is_y1 && is_y2) {
			len = x2 - x1 + 1;
			graphics_fill_area( (-x2 + cx),(y1 + cy),  len,1, fill_color);   //x,y  y的bottom>top
			graphics_fill_area( (x1 + cx),(y1 + cy),  len,1, fill_color);    //x,-y
			graphics_fill_area( (-x2 + cx),(-y1 + cy),  len,1, fill_color);   //-x,-y
			graphics_fill_area( (x1 + cx),(-y1 + cy),   len,1, fill_color);   //-x,y

			Bresenham_circle_iterator(y1, x1);
			Bresenham_circle_iterator(y2, x2);
		}
		if (is_y1==false)
		{
			graphics_draw_point((x1 + cx), (y1 + cy), fill_color);     //x,y
			graphics_draw_point((x1 + cx), (-y1 + cy), fill_color);    //x,-y
			graphics_draw_point((-x1 + cx), (-y1 + cy), fill_color);   //-x,-y
			graphics_draw_point((-x1 + cx), (y1 + cy), fill_color);   //-x,y
			Bresenham_circle_iterator(y1, x1);
		}
		if (is_y2 == false)
		{
			Bresenham_circle_iterator(y2, x2);
		}
	}
	y1 = y2;
	while (y2 <= r2 || x2 >= 0)
	{
		if (y1 == y2) {
			y1++;
			graphics_fill_area((-x2 + cx), (y2 + cy),  (x2 << 1) + 1,1, fill_color);   //-x,y
			graphics_fill_area((-x2 + cx), (-y2 + cy), (x2 << 1) + 1,1, fill_color);   //x,y
		}
		Bresenham_circle_iterator(y2, x2);
	}
}


/// <summary>
/// 绘制实心圆角矩形，无边框
/// </summary>
/// <param name="left">圆角矩形左边界</param>
/// <param name="top">圆角矩形右边界</param>
/// <param name="w">圆角矩形的宽</param>
/// <param name="h">圆角矩形的高</param>
/// <param name="r">圆角半径</param>
/// <param name="fill_color">填充颜色</param>
void draw_solidroundedrectangle(int left, int top, int w, int h,
	int r, COLOR_RGB fill_color) {

	draw_roundedrectangle(left, top, w, h, r, w, fill_color);
}


/// <summary>
/// 绘制圆角矩形。可以设定圆角半径，边框的线宽，边框颜色，填充颜色,是否填充。
/// 主要用在绘制UI控件上。
/// 绘制的区域由left,  top,  w,  h 决定。
/// </summary>
/// <param name="left">圆角矩形左边界</param>
/// <param name="top">圆角矩形右边界</param>
/// <param name="w">圆角矩形的宽</param>
/// <param name="h">圆角矩形的高</param>
/// <param name="r">圆角半径</param>
/// <param name="line_width">线宽</param>
/// <param name="line_color">边框线的颜色</param>
/// <param name="fill_color">填充颜色</param>
void draw_roundedrectangle(int left, int top, int w, int h,
	int r, int line_width, COLOR_RGB line_color)
{
	//先判断圆角半径是否过大。

	if (r > w / 2) r = w / 2;
	if (r > h / 2) r = h / 2;
	if (line_width > w / 2)line_width = w / 2 + 1;
	if (line_width > h / 2)line_width = h / 2 + 1;
	int r2 = r;
	int r1;
	if (r > line_width)r1 = r - line_width;
	else r1 = 0;
	int c_l = left + r;
	int c_r = left + w - r - 1;
	int c_t = top + r;
	int c_b = top + h - r - 1;
	//  r1 是内径，r2是外径
	Bresenham_circle_iterator_init(y1, x1, r1);
	Bresenham_circle_iterator_init(y2, x2, r2);
	int len;
	while (y1 <= r1 && x1 >= 0)
	{
		if (is_y1 && is_y2) {
			len = x2 - x1 + 1;
			graphics_fill_area((-x2 + c_l), (y1 + c_b), len, 1, line_color);   //x,y  y的bottom>top
			graphics_fill_area((x1 + c_r), (y1 + c_b), len, 1, line_color);    //x,-y
			graphics_fill_area((-x2 + c_l), (-y1 + c_t), len, 1, line_color);   //-x,-y
			graphics_fill_area((x1 + c_r), (-y1 + c_t), len, 1, line_color);   //-x,y

			Bresenham_circle_iterator(y1, x1);
			Bresenham_circle_iterator(y2, x2);
		}
		if (is_y1 == false)
		{
			graphics_draw_point((x1 + c_r), (y1 + c_b), line_color);     //x,y
			graphics_draw_point((x1 + c_r), (-y1 + c_t), line_color);    //x,-y
			graphics_draw_point((-x1 + c_l), (-y1 + c_t), line_color);   //-x,-y
			graphics_draw_point((-x1 + c_l), (y1 + c_b), line_color);   //-x,y
			Bresenham_circle_iterator(y1, x1);
		}
		if (is_y2 == false)
		{
			Bresenham_circle_iterator(y2, x2);
		}
	}
	y1 = y2;
	len = c_r - c_l;
	while (y2 <= r2 || x2 >= 0)
	{
		if (y1 == y2) {
			y1++;
			graphics_fill_area((-x2 + c_l), (y2 + c_b), (x2 << 1) + len + 1, 1, line_color);   //-x,y
			graphics_fill_area((-x2 + c_l), (-y2 + c_t), (x2 << 1) + len + 1, 1, line_color);   //x,y
		}
		Bresenham_circle_iterator(y2, x2);
	}
	if (line_width <= 0)line_width = 1;
	// 补充两列
	graphics_fill_area(left, c_t, line_width, c_b - c_t + 1, line_color);
	graphics_fill_area(left + w - line_width, c_t, line_width, c_b - c_t + 1, line_color);

	if (line_width > r) {
		graphics_fill_area(left + line_width, c_t, 
			w+1 - (line_width << 1), line_width - r, line_color);
		graphics_fill_area(left + line_width, top + h - line_width, 
			w+1 - (line_width << 1), line_width - r, line_color);
	}

}


/// <summary>
/// 画长方形函数
/// </summary>
/// <param name="left">长方形的左边x轴坐标</param>
/// <param name="top">长方形的上边y轴坐标</param>
/// <param name="w">长方形的宽</param>
/// <param name="h">长方形的高</param>
/// <param name="color">长方形的颜色</param>
void draw_rectangle(int left, int top, int w, int h, COLOR_RGB color)
{
	graphics_fill_area(left, top, w, 1, color);
	graphics_fill_area(left, top, 1, h, color);
	graphics_fill_area(left, top + h, w, 1, color);
	graphics_fill_area(left + w, top, 1, h, color);
}

/// <summary>
/// 画实心长方形函数
/// </summary>
/// <param name="left">长方形的左边x轴坐标</param>
/// <param name="top">长方形的上边y轴坐标</param>
/// <param name="w">长方形的宽</param>
/// <param name="h">长方形的高</param>
/// <param name="color">长方形的颜色</param>
void draw_solidrectangle(int left, int top, int w, int h, COLOR_RGB color)
{
	graphics_fill_area(left, top, w, h, color);
}

/// <summary>
/// 画三角形函数。坐标数组取前三个元素。
/// </summary>
/// <param name="pointsx">顶点的x轴坐标数组</param>
/// <param name="pointsy">顶点的y轴坐标数组</param>
/// <param name="color">三角形颜色</param>
void draw_triangle(int* pointsx, int* pointsy, COLOR_RGB color)
{
	draw_line(pointsx[0], pointsy[0], pointsx[1], pointsy[1], color);
	draw_line(pointsx[0], pointsy[0], pointsx[2], pointsy[2], color);
	draw_line(pointsx[1], pointsy[1], pointsx[2], pointsy[2], color);
}

/// <summary>
/// 绘制多边形函数。
/// </summary>
/// <param name="pointsx">顶点的x轴坐标数组</param>
/// <param name="pointsy">顶点的y轴坐标数组</param>
/// <param name="num">多边形顶点数量</param>
/// <param name="color">多边形颜色</param>
void draw_polygon(int* pointsx, int* pointsy, int num, COLOR_RGB color)
{
	int i;
	for (i = 1; i < num; i++) {
		draw_line(pointsx[i], pointsy[i], pointsx[i - 1], pointsy[i - 1], color);
	}
	draw_line(pointsx[0], pointsy[0], pointsx[num - 1], pointsy[num - 1], color);
}
//

/// <summary>
/// 画实心长方形图标。
/// 颜色数组，从左到右，从上到下，到了宽度自动换行，数组长度是w*h。
/// </summary>
/// <param name="left">长方形的左边x轴坐标</param>
/// <param name="top">长方形的上边y轴坐标</param>
/// <param name="w">长方形的宽</param>
/// <param name="h">长方形的高</param>
/// <param name="color">颜色数组</param>
void draw_icon(int left, int top, int w, int h, const COLOR_RGB* color)
{
	graphics_draw_image(left, top, w, h, color);
}



////////////////////////////////////////////////////////////////////////////////////////


#include"gl_TextFont.h"
// 下面是测试函数
#include<math.h>
int test_graphics()
{
	float pi = 3.1415926;
	int n = 200, i;
	float radius = 600.0f;
	graphics_init(); //初始化绘图设备


	for (int r = 3; r < 300; r += 14) {
		int n = 20;
		for (i = 0; i < n; i++) {		//测试画线函数。

			int dx = r * cosf(2 * pi * i / n);
			int dy = r * sinf(2 * pi * i / n);

			draw_arrow(300, 300, 300 + dx, 300 + dy, RGB_red);
		//	GD_wait_key_input();
		}
		GD_wait_key_input();
		graphics_fill_area(0, 0, GraphicsDevice_width, GraphicsDevice_height, RGB_lightgray);		
	}



	for (i = 0; i < n; i++) {		//测试画线函数。
		draw_line(300, 300, 300 + radius * cosf(2 * pi * i / n), 300 + radius * sinf(2 * pi * i / n), RGB_red);
	}
//	GD_wait_key_input();

	draw_line(640, 430, 0, 400, RGB_red);  //观察一下走样严重的线。
	draw_line(640, 470, 0, 440, RGB_red);  //观察一下走样严重的线。
	draw_line_horizontal(400, -100, 800, 2, RGB_green);
	draw_line_vertical(635, -400, 800, 2, RGB_blue);
	draw_circle(57, 100, 37, RGB_blue);
	draw_solidcircle(157, 100, 37, RGB_green);
//	draw_circle_2(57, 300, 37, RGB_blue);
//	draw_solidcircle_2(157, 300, 37, RGB_green);
	draw_rectangle(190, 150, 90, 50, RGB_red);
	draw_solidrectangle(200, 170, 40, 20, RGB_green);


	//	Point2D pts[] = { {50, 230}, {230, 230}, {230, 50}, {300, 100} };
	{
		int ptsx[] = { 150,230,230,300 };
		int ptsy[] = { 250,230,180,100 };
		draw_polygon(ptsx, ptsy, 4, RGB_black);
	}
	{
		TextFont tf;

		tf.backColor = RGB_white;
		tf.textColor = RGB_red;
		tf.size = 0;

#if(FontSize16 == 1)
		tf.size = size16;
#elif(FontSize24 == 1)
		tf.size = size24;
#elif(FontSize32 == 1)
		tf.size = size32;
#elif(FontSize48 == 1)
		tf.size = size48;
#endif

		tf.textMode = 1;
		draw_string(40, 40 , "1234ab  dcDFSE", 12, tf);
		tf.textMode = 0;
		draw_string(40, 150, "123 ? !+=-()!4", 12, tf);

		draw_string(40, 200, "1234abdcDFSE98", 12, tf);

		draw_string_no_frame(440, 40, "1234ab  dcDFSE", 12, tf);
		draw_string_no_frame(440, 150, "123 ? !+=-()!4", 12, tf);
		draw_string_no_frame(440, 200, "1234abdcDFSE98", 12, tf);
		

	}
	GD_wait_key_input();


	graphics_init(); //初始化绘图设备
	int w = 30;
	while (w >= 0)
	{
		graphics_fill_area(0, 0, 800, 800, RGB_lightgray);
		draw_roundedrectangle(4, 56, 100, 44, w,20, RGB_line_blue);
		draw_roundedrectangle(4, 156, 40, 99, w,20, RGB_line_blue);

		
		draw_solidroundedrectangle(204, 56, 100, 44, w, RGB_line_blue);
		draw_solidroundedrectangle(204, 156, 40, 99, w, RGB_line_blue);

//		GD_wait_key_input();

		w--;
	}



	GD_wait_key_input();



	return 0;
}








